import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int count = 0;
        for(int i = 2; i <= n; i++){
            if(isPerfect(i)) count++;
        }
        System.out.print(count);
    }

    public static boolean isPerfect(int num){
        int sum = 0;
        for(int i = 2; i*i <= num ; i++){
            if(num % i == 0){
                sum += i;
                if(num / i != i){
                    sum += (num/i);
                }
            }
        }
        sum++;
        return sum == num;
    }
}


